﻿using System;
using System.Collections.Generic;
using System.Text;
using BCMS.Business.DataContract;

namespace BCMS.FrontEnd.DataContract
{
    public class ReleaseBriefUI
    {
        public decimal ParValue { set; get; }
        public string Target { set; get; }
        public string Kind { set; get; }
        public string Detail { set; get; }
        public string Status { set; get; }

        public long TotalQtty { set; get; }
        public decimal TotalValue { set; get; }

        public ReleaseBriefUI() { }

        public ReleaseBriefUI(ReleaseBrief item)
        {
            this.ParValue = item.ParValue;
            this.Detail = item.Detail;
            this.TotalQtty = item.TotalQtty;
            this.TotalValue = item.TotalValue;

            switch (item.Target)
            {
                case (int)RTarget.CUSTOMER:
                    this.Target = "Khách hàng";
                    break;
                case (int)RTarget.PARTNER:
                    this.Target = "Đối tác";
                    break;
                case (int)RTarget.STAFF:
                    this.Target = "Nhân viên";
                    break;
                case (int)RTarget.OTHER:
                    this.Target = "Khác";
                    break;
                default:
                    this.Target = "UNKNOWN";
                    break;
            }
            switch (item.Kind)
            {
                case (int)RKind.SELL:
                    this.Kind = "Bán";
                    break;
                case (int)RKind.DISCOUNT:
                    this.Kind = "Chiết khấu";
                    break;
                case (int)RKind.GIFT:
                    this.Kind = "Quà tặng";
                    break;
                case (int)RKind.OTHER:
                    this.Kind = "Khác";
                    break;
                default:
                    this.Kind = "UNKNOWN";
                    break;
            }
            switch (item.Status)
            {
                case (int)RStatus.NORMAL:
                    this.Status = string.Empty;
                    break;
                case (int)RStatus.DISPOSED:
                    this.Status = "Đã hủy";
                    break;
                case (int)RStatus.DELETED:
                    this.Status = "Đã xóa";
                    break;
                default:
                    this.Status = "UNKNOWN";
                    break;
            }
        }
    }
}
